package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入订单明细数据
     *
     * @param orderDetailArrayList
     */
    void insertBatce(ArrayList<OrderDetail> orderDetailArrayList);

    /**
     * 根据id查询数据
     *
     * @param id
     * @return
     */
    @Select("select * from order_detail where id=#{id}")
    List<OrderDetail> getFromById(Long id);

    /**
     * 根据订单id查询订单明细
     *
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    /**
     * 根据id查询前10的订单
     *
     * @param idList
     * @return
     */
    List<HashMap> getTop10(List<Long> idList);

}
